<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>约健</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">

    {include file="public:headfile"}
</head>

<body class="hold-transition sidebar-mini">
<div class="wrapper">

    {include file="public:head"}

    {include file="public:slidemenu"}

    <div class="content-wrapper">

        <section class="content-header">
            <div class="container-fluid">
                <div class="row mb-2">
                    <div class="col-sm-6">
                        <h1> {$master.mastername} 的视频列表</h1>
                    </div>
                </div>
            </div>
        </section>



        <!-- Main content -->
        <section class="content">
            <div class="row">
                <div class="col-12">
                    <div class="card">
                        <div class="card-header">
                            <button class="btn btn-default" data-toggle="modal" data-target="#addModal">添加大师视频</button>
                        </div>
                        <!-- /.card-header -->
                        <div class="card-body">
                            <table id="example2" class="table table-bordered table-hover">
                                <thead>
                                <tr>
                                    <th> 编号</th>
                                    <th> 视频名</th>
                                    <th> 视频</th>
                                    <th> 视频简介</th>
                                    <th> 操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                {volist name='list' id='vo'}
                                <tr>
                                    <td> {$i}</td>
                                    <td> {$vo.vname}</td>
                                    <td>
                                        <video src="__STATIC__/video/{$vo.vfile}" style="width:150px;height:100px;" controls="controls" preload="metadata"></video>
                                    </td>
                                    <td> <pre>{$vo.vintro}</pre></td>
                                    <td>
                                        <a class="btn btn-default" href="{:url('master_controller/deleteVideo',['vid'=>$vo['vid']])}">删除</a>
                                    </td>
                                </tr>
                                {/volist}
                                </tbody>
                            </table>
                        </div>
                        <!-- /.card-body -->
                        <div class="dataTables_paginate paging_simple_numbers">{$list->render()}</div>
                    </div>
                    <!-- /.card -->
                </div>
                <!-- /.col -->
            </div>
            <!-- /.row -->
        </section>
        <!-- /.content -->

    </div>
</div>

{include file="public:footfile"}

</body>

<div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby="addModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title" id="addModalLabel">添加视频</h4>
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
            </div>
            <div class="modal-body">
                <form role="form" action="{:url('master_controller/addVideo')}" method="post" enctype="multipart/form-data" name="form1">
                    <div class="card-body">
                        <div class="form-group">
                            <label>视频名：</label>
                            <input type="text" name="vname" class="form-control" placeholder="请填写大师姓名">
                        </div>
                        <div class="form-group">
                            <label>视频：</label>
                            <input type="file" name="vfile" class="form-control">
                        </div>
                        <div class="form-group">
                            <label>简介：</label>
                            <textarea name="vintro" cols="25" rows="3" class="form-control"></textarea>
                        </div>
                        <input type="hidden" name="masterid" value="{$master.masterid}">
                    </div>

            </div>
            <div class="modal-footer">
                <button type="submit" class="btn btn-primary">提交更改</button>
                </form>
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>

</html>